package com.stu.spring.context.chapter13.springjms;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;

import javax.jms.*;

public class SpringJmsReceiver {

    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("chapter13\\springActiveMQ.xml");
        JmsTemplate jmsTemplate = (JmsTemplate)context.getBean("jmsTemplate");
        Destination destination = (Destination)context.getBean("connectionFactory");

        TextMessage msg = (TextMessage)jmsTemplate.receive(destination);
        System.out.println("receive msg is : " + msg.getText());
    }
}
